package com.lfy.service.Impl;

import com.lfy.dao.UserDao;
import com.lfy.domian.User;
import com.lfy.service.Crud;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CrudImpl implements Crud {
    @Resource
    private UserDao userDao;

    @Override
    public User selectUser(String id) {
        return userDao.selectUser(id);

    }

    @Override
    public int updateUserById(User user) {
        return userDao.updateUserById(user);

    }

    @Override
    public int deleteUserById(String id) {
        return userDao.deleteUserById(id);
    }

    @Override
    public int updateUserListById(List<User> users) {
        return 0;
    }

    @Override
    public int deleteUserListById(List<User> users) {
        return 0;
    }

    @Override
    @Transactional
    public int insertUser() {
        User user = new User("1", "1", "1", "1", "1", "1", "1");
        int i = userDao.insertUser(user);


      int a = 1/0;


        User user2 = new User("2", "1", "1", "1", "1", "1", "1");
        int i2 = userDao.insertUser(user2);
        return 0;
    }


}
